import Vue from 'vue'
import VueRouter from 'vue-router'
import * as dayjs from 'dayjs'
import * as isLeapYear from 'dayjs/plugin/isLeapYear' // 导入插件
import 'dayjs/locale/zh-cn' // 导入本地化语言
var customParseFormat = require('dayjs/plugin/customParseFormat')

dayjs.extend(isLeapYear) // 使用插件
dayjs.locale('zh-cn') // 使用本地化语言
dayjs.extend(customParseFormat)

Vue.use(VueRouter)

const routes = [
    // { path: "/", redirect: "/"},
    // {
    //     path: '/',
    //     component: () => import('@/views/homePage/homePage')
    // }
]

const router = new VueRouter({
    mode: 'history',
    base: '/dist/',
    routes
})
//
const routerPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
    return routerPush.call(this, location).catch((error) => error)
}
router.beforeEach(async (to, from, next) => {
  next()
})

export default router